define(function(require,exports,module){
	var Form = require("form");
	
	module.exports = {
		initComponent: function(widget){
			var form = new Form({
				parentNode: ".J-form",
				model: {
					id: "form",
					saveaction: function(){
						widget.service.save(widget.model.prepSaveParams(widget),
								function(data){
							widget.get("grid").refresh();
							widget.toList();
						});
					},
					cancelaction: function(){
						widget.toList();
					},
					items: [{
						name: "pkProduct",
						type: "hidden"
					},{
						name: "version",
						type: "hidden",
						defaultValue: 0
					},{
						name: "name",
						label: "产品名称",
						validate: ["required"]
					},{
						name: "description",
						label: "产品备注",
						type: "textarea"
					}]
				}
			});
			widget.set("form",form);
		}
	};
});